BIM Preflight/de

Other languages:

BIM Preflight

Menu location
Manage → Preflight checks...
Workbenches
BIM
Default shortcut
None
Introduced in version
-
See also
None

Beschreibung

The BIM Preflight tool allows you to perform several tests on your model to verify its compatibility with IFC standards and best practices, and help you to detect possible issues you might want to fix.

As FreeCAD is a very loose and free-style modelling platform, the requirements are very low. You can basically model and organize your BIM model the way you like, using all the tools that FreeCAD offers, both from the BIM workbench and other workbenches. The IFC format, however, has some strict requirements, and other BIM applications that can read IFC files often bring additional limitations as they more than often have difficulties with certain entities or the way certain objects are modeled.

The results of most of the tests provided by this tool are optional, which means you can choose to export your model even if they fail. You are the one to assess if you need the test to pass or not. We tried our best to give sound information to help you decide.

Anwendung

Builtin tests

FreeCAD setup tests

Project organization tests

Objects & property tests

Compatibility tests

Custom tests

The Preflight tool also allows you to write custom tests, that will be appended after the built-in tools in the Preflight dialog, and run when using the Run all tests button. These tests are written in Python. They consists of simple functions inside one or more Python files. You can perform any operation you want inside those functions, they must just pass or fail, and in case they fail, show a message informing the user of what failed.

You can write several tests in one single Python file, or divide in several files, as you prefer. These files must be placed in $USERAPPDATA/BIM/Preflight and can be given any name (Be sure to use very unique names as to not conflict with any built-in Python module. The $USERAPPDATA folder depends on your platform/operating system (usually $HOME/.FreeCAD on linux/mac, /users/YOUR USER/Application Data/roaming/FreeCAD on windows), and can also be found by entering this in the FreeCAD Python console:

FreeCAD.getUserAppDataDir()

Inside each Python file, tests are simple functions that take no argument, and return either True if the test passed, or a string of text that will be shown to the user if the test failed.

A typical test file would be like this, that should be named something like "myCustomTest.py" and placed inside $USERAPPDATA/BIM/Preflight:

import FreeCAD

# The name of your test. You can give the functions any name
# you want, the important is the description text below

def myCustomTest():

   # This describes what your test does. For example,
   # here, it checks that there is at least one object in the document.
   # This text will appear next to the button in the Preflight tool

   """Checks that the document contains at least one object"""

   doc = FreeCAD.ActiveDocument
   objects = doc.Objects
   if len(objects) >= 1:
       result = True
   else:
       result = "This document contains no object"

   # The function must return either True or a string of
   # text if the test failed. The string or text will be displayed
   # to the user when they press the "Failed" button.

   return result